package com.example.demo.controller.common;

import com.example.demo.domain.entity.Notice;
import com.example.demo.domain.exam.ExamClass;
import com.example.demo.dto.ItemDto;
import com.example.demo.dto.NoticeDto;
import com.example.demo.dto.ResponseDto;
import com.example.demo.service.NoticeService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * TODO
 *
 * @author mazh47622
 * @date2024/2/29
 * @modify -----------------------------------------------------------------------------------------------------
 * |修改单号|修改人员|修改日期|评审人员|修改说明
 * -----------------------------------------------------------------------------------------------------
 * |      |       |      |       |
 * -----------------------------------------------------------------------------------------------------
 */
@Controller
@RequestMapping("/notice")
public class NoticeController {

    @Resource
    private NoticeService noticeService;


    @RequestMapping("/list")
    @ResponseBody
    public ResponseDto<List<Notice>> queryNotice(@RequestBody NoticeDto noticeDto) {
        List<Notice> data = noticeService.queryNotice(noticeDto);
        ResponseDto<List<Notice>> result = new ResponseDto().buildSucceedHasData(data);
        return result;
    }

    @RequestMapping("/update")
    @ResponseBody
    public ResponseDto updateNotice(@RequestBody NoticeDto noticeDto) {
        noticeService.updateNotice(noticeDto);
        return new ResponseDto<>().buildSucceedHasData(true);
    }
}
